package cn.like.datasource.support;

import cn.like.base.support.id.IdGenerator;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;

public class CustomIdGenerator implements IdentifierGenerator {

    private final IdGenerator idGenerator;

    public CustomIdGenerator(IdGenerator idGenerator) {this.idGenerator = idGenerator;}

    @Override
    public Number nextId(Object entity) {
        return idGenerator.snowflakeId();
    }

    @Override
    public String nextUUID(Object entity) {
        return idGenerator.uuid();
    }
}